package com.campus.commons.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;

import com.baomidou.mybatisplus.annotation.TableName;
import com.campus.app.mapper.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * <p>
 * 助教团辅导班级表
 * </p>
 *
 * @author Rin
 * @since 2020-12-24
 */
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="Counsellor对象", description="助教团辅导班级表")
@TableName(excludeProperty ={"className","classroomName","studentName"} )

public class Counsellor implements Serializable {
    public Counsellor(Integer classroomid, Integer studentid, Integer classid) {
        this.classroomid = classroomid;
        this.studentid = studentid;
        this.classid = classid;
    }

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "日期")
    private Date date;

    @ApiModelProperty(value = "教室id")
    @TableField("classRoomId")
    private Integer classroomid;
    @NotNull(groups = Update.class)
private  String classroomName;
    @ApiModelProperty(value = "辅导人员")
    @TableField("studentId")
    private Integer studentid;
    @NotBlank(groups = Update.class,message = "辅导人员不能为空")
private String studentName;
    @ApiModelProperty(value = "班级id")
    @TableField("classId")
    private Integer classid;
    @NotBlank(groups = Update.class,message = "班级不能为空")
    private String className;

    public Counsellor(Date date, Integer classroomid, Integer studentid, Integer classid) {
        this.date = date;
        this.classroomid = classroomid;
        this.studentid = studentid;
        this.classid = classid;
    }

    public void setClassid(Integer classid) {
        this.classid = classid;
        this.className = Class.classes.get(classid).getClassname();
    }

    public void setClassroomid(Integer classroomid) {
        this.classroomid = classroomid;
        this.classroomName = ClassRoom.classrooms.get(classroomid);
    }

    public void setStudentid(Integer studentid) {
        this.studentid = studentid;
        this.studentName = Student.students.get(studentid).getStuname();
    }
}
